@TestOn('vm')
import 'package:applications/api/applications_api.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  group('#test requests', () {
    late ApplicationsAPI api = ApplicationsAPI();

    test('ApplicationsAPI topgrossing', () async {
      var response = await api.topgrossing();
      expect(response.length, 10);
    });

    test('ApplicationsAPI topfree', () async {
      var response = await api.topfree();
      expect(response.length, 100);
    });

    test('ApplicationsAPI lookup', () async {
      var response = await api.topfree(limit: 10);
      int id = int.tryParse(response.first.id?.attributes?.imId ?? '0') ?? 0;
      var response2 = await api.lookup(id: id);
      assert(response2.isNotEmpty);
      expect(response2.entries.length, 4);
    });
  });
}
